//
//  SSEmoticon.swift
//  weibo
//
//  Created by 邵帅 on 16/7/2.
//  Copyright © 2016年 groupNineObject. All rights reserved.
//

import UIKit

class SSEmoticon: NSObject {
    
    var code: String? {
        
        didSet{
            
            // 16进制 -> Character
            // 创建一个NSScanner
            let scanner = NSScanner(string: code!)
            // 定义一个UInt32类型的变量,用于接收扫描返回的数据
            var result: UInt32 = 0
            scanner.scanHexInt(&result)
            // 把result 转换成Unicode
            let unicode = UnicodeScalar(result)
            // 把unicdoe转换成Character
            let character = Character(unicode)
            
            emoji = "\(character)"
        }
        
    }
    
    // 单独定义一个属性,用于存储处理过的emoji
    var emoji: String?
    
    var chs: String?
    var png: String?
    var path: String?

    init(dict: [String: AnyObject]) {
        
        super.init()
        
        setValuesForKeysWithDictionary(dict)
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
        
    }
}
